package com.ruoyi.system.service.impl;

import java.util.Date;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.GfOrdersMapper;
import com.ruoyi.system.domain.GfOrders;
import com.ruoyi.system.service.IGfOrdersService;

import cn.hutool.core.collection.CollUtil;

/**
 * 订单信息Service业务层处理
 * 
 * @author ruoyi
 * @date 2022-06-16
 */
@Service
public class GfOrdersServiceImpl implements IGfOrdersService 
{
    @Autowired
    private GfOrdersMapper gfOrdersMapper;

    /**
     * 查询订单信息
     * 
     * @param orderId 订单信息主键
     * @return 订单信息
     */
    @Override
    public GfOrders selectGfOrdersByOrderId(Long orderId)
    {
        return gfOrdersMapper.selectGfOrdersByOrderId(orderId);
    }

    /**
     * 查询订单信息列表
     * 
     * @param gfOrders 订单信息
     * @return 订单信息
     */
    @Override
    public List<GfOrders> selectGfOrdersList(GfOrders gfOrders)
    {
        return gfOrdersMapper.selectGfOrdersList(gfOrders);
    }

    /**
     * 新增订单信息
     * 
     * @param gfOrders 订单信息
     * @return 结果
     */
    @Override
    public int insertGfOrders(GfOrders gfOrders)
    {
        return gfOrdersMapper.insertGfOrders(gfOrders);
    }

    /**
     * 修改订单信息
     * 
     * @param gfOrders 订单信息
     * @return 结果
     */
    @Override
    public int updateGfOrders(GfOrders gfOrders)
    {
        return gfOrdersMapper.updateGfOrders(gfOrders);
    }

    /**
     * 批量删除订单信息
     * 
     * @param orderIds 需要删除的订单信息主键
     * @return 结果
     */
    @Override
    public int deleteGfOrdersByOrderIds(Long[] orderIds)
    {
        return gfOrdersMapper.deleteGfOrdersByOrderIds(orderIds);
    }

    /**
     * 删除订单信息信息
     * 
     * @param orderId 订单信息主键
     * @return 结果
     */
    @Override
    public int deleteGfOrdersByOrderId(Long orderId)
    {
        return gfOrdersMapper.deleteGfOrdersByOrderId(orderId);
    }

    @Override
    public boolean haveDuplicateEnableOrder(Date orderStartTime, String trainId, String seatNum) {
        List a = gfOrdersMapper.selectDuplicateEnableOrder(orderStartTime, trainId, seatNum);
        return CollUtil.isNotEmpty(a);
    }
}
